/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <plugins/plugin.h>
#include <plugins/plugin_loader.h>

plugin_t *pkcs11_plugin_create();
plugin_t *aes_plugin_create();
plugin_t *des_plugin_create();
plugin_t *rc2_plugin_create();
plugin_t *sha2_plugin_create();
plugin_t *sha1_plugin_create();
plugin_t *md5_plugin_create();
plugin_t *random_plugin_create();
plugin_t *nonce_plugin_create();
plugin_t *x509_plugin_create();
plugin_t *revocation_plugin_create();
plugin_t *constraints_plugin_create();
plugin_t *pubkey_plugin_create();
plugin_t *pkcs1_plugin_create();
plugin_t *pkcs7_plugin_create();
plugin_t *pkcs12_plugin_create();
plugin_t *pgp_plugin_create();
plugin_t *dnskey_plugin_create();
plugin_t *sshkey_plugin_create();
plugin_t *pem_plugin_create();
plugin_t *openssl_plugin_create();
plugin_t *pkcs8_plugin_create();
plugin_t *af_alg_plugin_create();
plugin_t *fips_prf_plugin_create();
plugin_t *curve25519_plugin_create();
plugin_t *xcbc_plugin_create();
plugin_t *cmac_plugin_create();
plugin_t *hmac_plugin_create();
plugin_t *kdf_plugin_create();
plugin_t *ctr_plugin_create();
plugin_t *ccm_plugin_create();
plugin_t *gcm_plugin_create();
plugin_t *drbg_plugin_create();

static void register_plugins() __attribute__ ((constructor));
static void register_plugins()
{
	plugin_constructor_register("pkcs11", pkcs11_plugin_create);
	plugin_constructor_register("aes", aes_plugin_create);
	plugin_constructor_register("des", des_plugin_create);
	plugin_constructor_register("rc2", rc2_plugin_create);
	plugin_constructor_register("sha2", sha2_plugin_create);
	plugin_constructor_register("sha1", sha1_plugin_create);
	plugin_constructor_register("md5", md5_plugin_create);
	plugin_constructor_register("random", random_plugin_create);
	plugin_constructor_register("nonce", nonce_plugin_create);
	plugin_constructor_register("x509", x509_plugin_create);
	plugin_constructor_register("revocation", revocation_plugin_create);
	plugin_constructor_register("constraints", constraints_plugin_create);
	plugin_constructor_register("pubkey", pubkey_plugin_create);
	plugin_constructor_register("pkcs1", pkcs1_plugin_create);
	plugin_constructor_register("pkcs7", pkcs7_plugin_create);
	plugin_constructor_register("pkcs12", pkcs12_plugin_create);
	plugin_constructor_register("pgp", pgp_plugin_create);
	plugin_constructor_register("dnskey", dnskey_plugin_create);
	plugin_constructor_register("sshkey", sshkey_plugin_create);
	plugin_constructor_register("pem", pem_plugin_create);
	plugin_constructor_register("openssl", openssl_plugin_create);
	plugin_constructor_register("pkcs8", pkcs8_plugin_create);
	plugin_constructor_register("af-alg", af_alg_plugin_create);
	plugin_constructor_register("fips-prf", fips_prf_plugin_create);
	plugin_constructor_register("curve25519", curve25519_plugin_create);
	plugin_constructor_register("xcbc", xcbc_plugin_create);
	plugin_constructor_register("cmac", cmac_plugin_create);
	plugin_constructor_register("hmac", hmac_plugin_create);
	plugin_constructor_register("kdf", kdf_plugin_create);
	plugin_constructor_register("ctr", ctr_plugin_create);
	plugin_constructor_register("ccm", ccm_plugin_create);
	plugin_constructor_register("gcm", gcm_plugin_create);
	plugin_constructor_register("drbg", drbg_plugin_create);
}

static void unregister_plugins() __attribute__ ((destructor));
static void unregister_plugins()
{
	plugin_constructor_register("pkcs11", NULL);
	plugin_constructor_register("aes", NULL);
	plugin_constructor_register("des", NULL);
	plugin_constructor_register("rc2", NULL);
	plugin_constructor_register("sha2", NULL);
	plugin_constructor_register("sha1", NULL);
	plugin_constructor_register("md5", NULL);
	plugin_constructor_register("random", NULL);
	plugin_constructor_register("nonce", NULL);
	plugin_constructor_register("x509", NULL);
	plugin_constructor_register("revocation", NULL);
	plugin_constructor_register("constraints", NULL);
	plugin_constructor_register("pubkey", NULL);
	plugin_constructor_register("pkcs1", NULL);
	plugin_constructor_register("pkcs7", NULL);
	plugin_constructor_register("pkcs12", NULL);
	plugin_constructor_register("pgp", NULL);
	plugin_constructor_register("dnskey", NULL);
	plugin_constructor_register("sshkey", NULL);
	plugin_constructor_register("pem", NULL);
	plugin_constructor_register("openssl", NULL);
	plugin_constructor_register("pkcs8", NULL);
	plugin_constructor_register("af-alg", NULL);
	plugin_constructor_register("fips-prf", NULL);
	plugin_constructor_register("curve25519", NULL);
	plugin_constructor_register("xcbc", NULL);
	plugin_constructor_register("cmac", NULL);
	plugin_constructor_register("hmac", NULL);
	plugin_constructor_register("kdf", NULL);
	plugin_constructor_register("ctr", NULL);
	plugin_constructor_register("ccm", NULL);
	plugin_constructor_register("gcm", NULL);
	plugin_constructor_register("drbg", NULL);
}

